<%--
 *  File:    DistributortenderNote.jsp
 *  @Author: Dcdai
 *  Date:    2011-08-05

 *  Copyright (C) 2000 - 2009 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  //String privilegeCode = "11203";
  String strTableName = "v_tenderproperty";
  String strModuleName = "CRM";
  HashMap userinfo = new HashMap();
  userinfo = (HashMap)session.getAttribute("userinfo");
  Integer neworgid=new Integer(-1);
  if(userinfo.get("orgid")!=null)
  neworgid = (Integer)userinfo.get("orgid");
  String contextPath = request.getContextPath();

%>



<%@ include file="/inc/PageDefault.inc" %>
<%@include file="/inc/Print.inc"%>
<%@ include file="/inc/FrmDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>DistributortenderNote</title>
<PageFlow:CheckPageFlow pageName="p_disnotesummary"/>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<iframe name="reloadHandler" style="display:none" ></iframe>
<%@ include file ="/inc/NewCalendar.inc" %>
<script>

function clickProd(id,num)
{
  document.actionsummaryform.chooseactionid.value = id;
  document.actionsummaryform.chooseindexnum.value = num;
}
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(actionsummaryform,actionvalue,orderbyname);
  editform.action = "DistributortenderNote.jsp?<%= OvalTools.randomURL() %>&selectopt=all";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function openAll(t){
	if(t.checked)
	{
		document.actionsummaryform.needprod.disabled=false;
		document.actionsummaryform.contenttype.disabled=false;
	}else{
		document.actionsummaryform.needprod.checked=false;
		document.actionsummaryform.needprod.disabled=true;
		document.actionsummaryform.contenttype.value="-1";
		document.actionsummaryform.contenttype.disabled=true;
		document.actionsummaryform.sourcetype.value="-1";
		document.actionsummaryform.sourcetype.disabled=true;
	}
}
function openActionsource(){
var op = document.actionsummaryform.contenttype.value;
    
    if(op==-1)
   {       document.actionsummaryform.needprod.disabled=true;
        document.actionsummaryform.needprod.checked=false;
       
    }
   if  ((op==1)||(op==2)||(op==3)||(op==4)||(op==6)||(op==7)) {
       document.actionsummaryform.needprod.disabled=false;
       document.actionsummaryform.needprod.checked=false;
       
     }
     
      if  ((op==7)) {
      document.actionsummaryform.relatedpropertyid.disabled=false; 
      document.actionsummaryform.sqldesc.disabled=false;
     }
      if  (!(op==7)) {
      document.actionsummaryform.relatedpropertyid.value="-1"; 
      document.actionsummaryform.relatedpropertyid.disabled=true; 
      document.actionsummaryform.sqldesc.disabled=true;
     }
   if(op==4)
    {
           document.actionsummaryform.sourcetype.disabled=false;    
          
     }
       
   if ((op==1)||(op==2)||(op==3)||(op==6)||(op==7)){
       
              document.actionsummaryform.sourcetype.value="-1";
              document.actionsummaryform.sourcetype.disabled=true;
              document.actionsummaryform.sqldesc.disabled=true;

     }
     
   
}

function page_add(){
  
   var frm = document.actionsummaryform;
   frm.actionname.value = "add";
   frm.target = "_self";
   isRunning = true;
   frm.submit();
}

function page_delete(){
	if(document.actionsummaryform.chooseactionid!=null&&document.actionsummaryform.chooseactionid.value!="")
	{
		document.actionsummaryform.deldisnoteid.value = document.actionsummaryform.chooseactionid.value;
		
		  var flag = confirm('<%=message.getMessageDesc("ARE_YOU_SURE_DEL")%>');
  			if(!flag)
    		return;
   var frm = document.actionsummaryform;
   frm.actionname.value = "delete";
   frm.target = "_self";
   isRunning = true;
   frm.submit();

	}

}

function page_return(){
	parent.location.href = "DistributortenderSummary.jsp?<%= OvalTools.randomURL() %>";
}

function pop1(noteids)
{
	var id=document.actionsummaryform.distributortenderid.value;
	var noteid=noteids;
  	if (typeof popwindow != 'undefined') popwindow.close();
    popwindow = window.open("<%=contextPath%>/devlop/distributortender/DistributortenderAttachment.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&disnoteid="+noteid+"&distributortenderid="+id,"newwindow", "height=300, width=1200,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}


function page_popwindow(blue)
{
  if (typeof popwindow != 'undefined') popwindow.close();
  //popwindow = window.open("<%=contextPath%>/biee/EmployeeBussiseForPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
  popwindow = window.open("<%=contextPath%>/devlop/distributortender/DisEmployeeBussiseForPop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");	
}

function setSalesMan(userid,username,station){
	document.actionsummaryform.userid.value=userid;
	document.actionsummaryform.username.value=username;
	document.actionsummaryform.responsibilitytype.value=station;
	
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 <form name="actionsummaryform" method="post" action="../../Dispatcher">
      <input type="hidden" name="pagename" value="p_disnotesummary">
      	<input type="hidden" name="actionname">

<table width="100%" cellspacing="0" cellpadding="0" border="0">

  <tr>
    <td>
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">

        <tr class="deepblue-left">
          <td width="2%" class="title_center">&nbsp;</td>
          <td width="5%" class="title_center"><%= label.getLabelName("L_Sortno") %></td>
          <td width="47%" class="title_center"><%= label.getLabelName("L_Description") %></td>
          <td width="15%" class="title_center"><%= label.getLabelName("L_OfferObject") %></td>
          <td width="15%" class="title_center"><%= label.getLabelName("L_EndDate") %></td>
          <td width="15%" class="title_center"><%= label.getLabelName("L_accessory ")+label.getLabelName("L_Upload ") %></td>
          <!-- 
          <td width="8%" class="title_center"><%= label.getLabelName("L_accessory ")+label.getLabelName("L_Upload ")+ label.getLabelName("L_Time ")%></td>
          <td width="8%" class="title_center"><%= label.getLabelName("L_UploadMan") %></td>
           -->
        </tr>
        <%int i=0; %>
            <%
                        Vector totalsummary = (Vector) pageContext.getAttribute("totalsummary");
                        if (totalsummary == null)
                            totalsummary = new Vector();
                       Vector actionsourcecollection = (Vector) pageContext.getAttribute("actionsourcecollection");
                        if (actionsourcecollection == null)
                            actionsourcecollection = new Vector();
                            boolean bHasChecked = false;
                             String strClassType = new String("");
                             Integer nDefaultId = null;
                             Integer nDisId = null;
                             String strType = "";

               %>
               
               <%
	String distributortenderid = null;
	distributortenderid = (pageContext.getAttribute("distributortenderid")).toString(); 
	
	 //HashMap vinfo = (HashMap)pageContext.getAttribute("actionhash");
	 //if(vinfo == null)
	  //{
		 //vinfo = new HashMap();
	  //}
	 
	 //out.println(vinfo);

%>
	 <logic:iterate id="actionhash" collection="<%=totalsummary%>" indexId="orderid">
	 <%
	 //HashMap actionhash = (HashMap)pageContext.getAttribute("actionhash");
	 String strIsChecked ="";
	  
	 		            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
	      if(!bHasChecked)
            {
              strIsChecked = "checked";
              bHasChecked = true; 
              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("actionhash")).get("disnoteid");
              nDisId = (Integer)((HashMap)pageContext.getAttribute("actionhash")).get("dispictureid");
              //out.println(nDefaultId);
              strType=(String)((HashMap)pageContext.getAttribute("actionhash")).get("responsibilitytype");
              ///out.println(strType);
              %>
         <input type="hidden" name="chooseactionid"  id="chooseactionid" value="<custom:write property="disnoteid" name="actionhash" nbsp="true"/>">
          <input type="hidden" name="chooseindexnum"  id="chooseindexnum" value="<%=JspHelper.filterNull(i+1)%>">
            <%   }
              i++;
	 %>
	 <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('action<%=JspHelper.filterNull(i)%>');clickProd('<custom:write property="disnoteid" name="actionhash"/>','<%=JspHelper.filterNull(i)%>');" class="<%=JspHelper.filterNull( strClassType )%>" >
	 <td>
	 <input id="action<%=JspHelper.filterNull(i)%>" type="radio"  name="oneagreementpropertyid" value="<custom:write property="disnoteid" name="actionhash"/>"
	 onClick="javascript:clickProd('<custom:write property="disnoteid" name="actionhash" nbsp="true"/>','<%=JspHelper.filterNull(i)%>')" Class="normalradio" <%=strIsChecked%>/>
	 </td>
	 <td><custom:write property="stepno" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="description" name="actionhash" nbsp="true" /></td>
	 <%if(strType!=null && strType.equals("G")){ %>
	 <td><custom:write property="usergroupname" name="actionhash" nbsp="true" />
	 	 <custom:write property="employeename" name="actionhash" nbsp="true" />
	 <!-- 
	 	<custom:write property="responsibilitytype" name="actionhash" nbsp="true" />
	 	<custom:write property="employeename" name="actionhash" nbsp="true" />
	  -->
	 </td>
	 <%}else{ %>
	 <td><custom:write property="usernames" name="actionhash" nbsp="true" />
	 <!-- 
	 <td><custom:write property="employeename" name="actionhash" nbsp="true" />
	 	 <custom:write property="responsibilitytype" name="actionhash" nbsp="true" />
	  -->
	 </td>
	 <%} %>
	 <td><custom:write property="enddate" name="actionhash" nbsp="true" /></td>
	 <td class="title_center">
	 <a onclick="javascript:pop1('<custom:write property="disnoteid" name="actionhash" nbsp="true" />');"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif"	border="0" /></a></td>
	 <!-- 
	 <custom:write property="disnoteid" name="actionhash" nbsp="true" />
	 <%
	 if(nDisId==null){ %>
	 <td>&nbsp;</td>
	 <td>&nbsp;</td>
	 <%}else{%>
	 <td><custom:write property="uploaddate" name="actionhash" nbsp="true" /></td>
	 <td><custom:write property="username" name="actionhash" nbsp="true" /></td>	 
	 <%} %>
	  -->
	 </tr>
	 </logic:iterate>
	 <tr>
		 <td>&nbsp;</td>
		 <td><custom:write name="distributortenderinfo" property="stepno" nbsp="true"/></td>
		 <td><custom:textarea property="description" rows="2" cols="95"/></td>
		 <td>
			<custom:hidden  name="distributortenderinfo" property="userid"/>
           	<custom:text property="username" size="10"/>
           	<custom:hidden name="distributortenderinfo" property="responsibilitytype"/>
              <a onclick="page_popwindow();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
         </td>
	     <td>
	        <custom:text property="enddate"  dataType="date"  module="IMG" size="15"  command="notnull" label="L_EndDate"/>
	      <a onclick="javascript:c.show(this,'actionsummaryform.enddate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
	     </td>
		 <td class="title_center">
			<a onclick="javascript:pop1();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif"	border="0" /> </a>
		 </td>
		 
		 <!-- 
	     <td>
				<custom:write name="distributortenderinfo" property="uploaddate" dataType="date" dataFormatName="dateformat" nbsp="true"/>
	     </td>
		 <td>
		  		<custom:write name="distributortenderinfo" property="username" nbsp="true"/>
		 </td>
		  -->

			<custom:hidden name="actionhash"  property="distributortenderid" value="<%=distributortenderid%>" />
			
			
	 </tr>
	          <%@ include file="/inc/SummaryAction.inc" %>

    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top" ></td>
        </tr>

        <tr>
          <td class="td_center">
          <input type="hidden" name="deldisnoteid">
          <a onclick="page_add();"><custom:button type="1" label="L_Add" imgsrc="new.gif" border="0" style="width:60"/></a>
          <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
		  <a onclick="page_return()"><custom:button type="1" label="L_Back" border="0"  imgsrc="finish.gif" style="width:60" /></a>          
          </td>
        </tr>
      </table>

</table>
 </form>
</body>
</html>